package net.cyndeline.scalarlib.rldungeon.dgs

import scalax.collection.GraphEdge.UnDiEdge
import scalax.collection.immutable.Graph
import net.cyndeline.scalarlib.rldungeon.dgs.graph.{DGSFunctionality, Room}
import scalax.collection.GraphPredef.OuterEdge

/**
 * Used by parameters to parse a graph-representation of a map into a value representing the aspect of the map
 * that the parameter is interested in. Example: A parameter that is interested in the number of rooms (vertices)
 * in the graph has a ParameterEstimator that counts the number of vertices in the supplied graph and returns the
 * amount.
 */
trait ParameterEstimator[VType <: Room[VType], EType[X] <: UnDiEdge[X] with DGSFunctionality[X, EType] with OuterEdge[X, EType]] {

  /**
   * Parse a graph into a numerical value.
   * @param graph Graph to parse.
   * @return a value representing some aspect of the graph.
   */
  def value(graph: Graph[VType, EType]): Double

}
